<?php

namespace app\api\model;

use think\Model;


class BannerModel extends ApiModel
{

    

    

    // 表名
    protected $name = 'banner';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];
    public function getBanner(){
        $list = self::where(['status_switch' => 1])->field('id,name,image')->order('sort desc,id desc')->select();
        foreach($list as &$val){
            $val['image'] =  config('app.image_url').$val['image'];
        }
        return $this->api_success('获取成功',$list);
    }









}
